CREATE PROCEDURE coreWFTaskExitPathsSave
(
	@id					int output,
	@FK_TaskingID		int,
	@Caption			nvarchar(100),
	@uiTaskMethod		nvarchar(500),
	@CSV_AllowedGroups	nvarchar(500)
)
AS
BEGIN

	IF @id = -1
	BEGIN
		SET NOCOUNT ON;

		INSERT INTO WFTaskExitPaths (FK_TaskingID, Caption, uiTaskMethod, CSV_AllowedGroups )
		VALUES ( @FK_TaskingID, @Caption, @uiTaskMethod, @CSV_AllowedGroups );

		SET NOCOUNT OFF;
		SELECT @id = @@IDENTITY;

	END
	ELSE
	BEGIN
		
		UPDATE WFTaskExitPaths SET
			Caption				= @Caption,
			uiTaskMethod		= @uiTaskMethod,
			CSV_AllowedGroups	= @CSV_AllowedGroups
		WHERE PK_ID=@id;
				
	END
	
END
